$(window).on("load", function() {
	$("#search_text").on('keyup focus', function(event) {
		var searchText = $("#search_text").val();
		// bing服务器提供的api
		$.get('http://api.bing.com/qsonhs.aspx?q='+searchText, function(data) {
			var data = data.AS.Results[0].Suggests;
			var html = "";
 			for (var i = 0; i < data.length; i++) {
				html += '<li>'+data[i].Txt+'</li>';
			}
			$(".search_list > ul").html(html);
			$(".search_list").show().css({
				"position": "absolute",
				"top": $("#search_form").offset().top + $("#search_form").outerHeight() ,
				"left": $("#search_form").offset().left
			});
		},'json');
		$(document).on('click', function(event) {
			$(".search_list").hide();
		});
		$(document).delegate('li', 'click', function(event) {
			var keyword = $(this).text();
			// bing服务器提供的搜索页面
			location.href = 'http://cn.bing.com/search?q='+keyword;
		});
	});
})